home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- import wx
- from gui.textutil import default_font
- from wx.html import HtmlWindow, HW_SCROLLBAR_NEVER, HW_NO_SELECTION, EVT_HTML_LINK_CLICKED
-
- class HTMLLabel(HtmlWindow):
-
- def __init__(self, parent, label, **callbacks):
- HtmlWindow.__init__(self, parent, style = HW_SCROLLBAR_NEVER | HW_NO_SELECTION)
- self.SetLabel(label, **callbacks)
- self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))
- self.SetBorders(0)
- self.SetFonts(default_font().FaceName, 'Courier New')
- self.Bind(EVT_HTML_LINK_CLICKED, self._on_link)
-
-
- def SetLabel(self, label, **callbacks):
- if '<html>' not in label:
- label = '<html><body bgcolor="%s" padding=0 margins=0><font size="2">' % self.Parent.BackgroundColour.GetAsString(wx.C2S_HTML_SYNTAX) + label + '</font></body></html>'
-
- dc = wx.MemoryDC()
- dc.Font = default_font()
- self.Size = self.MinSize = dc.GetTextExtent(label)
- self.SetPage(label)
- self.callbacks = callbacks
-
- Label = property(HtmlWindow.ToText, SetLabel)
-
- def _on_link(self, e):
- url = e.GetLinkInfo().Href
-
- try:
- cb = self.callbacks[url]
- except KeyError:
- wx.LaunchDefaultBrowser(url)
-
- cb()
-
-
-